/**
 * Created by jt on 2017/5/6.
 */
import "./index.less";
import "../../../unit/common/js/bootstrap_js/jquery.min.js";
import "../../../unit/common/js/bootstrap_js/select2.min.js";
import "../../../unit/common/js/bootstrap_js/jquery.multi-select.js";
import "../../../unit/common/js/bootstrap_js/jquery.dataTables.js";
import "../../../unit/common/js/bootstrap_js/form-samples.js";
import "../../../unit/common/js/bootstrap_js/table-editable.js";
import "../../../unit/common/js/bootstrap_js/form-components.js";

jQuery(document).ready(function() {
    App.init();
    // FormComponents.init();
    var token = sessionStorage.getItem('token');
    if (token == null || token =='') {
        location.href = HOST_FRT+'/logins/login.html';
    }
    jQuery('.logOut').attr('href','../logins/login.html');
    var lnkId = getArgs().id;

    jQuery.ajax({
        url: HOST_ADDR+'/cpmp/lnkInf/view/'+lnkId,
        type: 'get',
        // data: JSON.stringify(data),
        dataType: 'json',
        contentType:"application/json",
        headers: {
            'access_token': token,'login_type':'ums'
        },
        success: function(resp){
            if (!resp.success) {
                alert(resp.msgCod+' '+resp.msgInf);
                return;
            }
            console.log(resp);

            jQuery('.lnkNam').text(resp.data.lnkNam);
            jQuery('.lnkId').text(resp.data.lnkId);
            jQuery('.lnkUrl').text(resp.data.lnkUrl);
            jQuery('.lnkPic').html('<img src="'+HOST_FILE +resp.data.lnkPic+'">');
        },
        error:function(err){
            console.log(err);
        }
    });

});